package hoan.nguyen.domain;

// Generated May 24, 2013 9:52:44 PM by Hibernate Tools 4.0.0

import static javax.persistence.GenerationType.IDENTITY;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * Level generated by hbm2java
 */
@Entity
@Table(name = "level", catalog = "test_hibernate")
public class Level implements java.io.Serializable {

	private Integer id;
	private String name;
	private String des;
	private LevelDetail levelDetail;
	private Set<Employee> employees = new HashSet<Employee>(0);

	public Level() {
	}

	public Level(String name, String des) {
		this.name = name;
		this.des = des;
	}

	public Level(String name, String des, LevelDetail levelDetail, Set<Employee> employees) {
		this.name = name;
		this.des = des;
		this.levelDetail = levelDetail;
		this.employees = employees;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "name", length = 45)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "des", length = 1000)
	public String getDes() {
		return this.des;
	}

	public void setDes(String des) {
		this.des = des;
	}

	@OneToOne(fetch = FetchType.LAZY, mappedBy = "level")
	public LevelDetail getLevelDetail() {
		return this.levelDetail;
	}

	public void setLevelDetail(LevelDetail levelDetail) {
		this.levelDetail = levelDetail;
	}

	@ManyToMany(fetch = FetchType.LAZY)
	@JoinTable(name = "employee_level", catalog = "test_hibernate", joinColumns = { @JoinColumn(name = "level_id", nullable = false, updatable = false) }, inverseJoinColumns = { @JoinColumn(name = "employee_id", nullable = false, updatable = false) })
	public Set<Employee> getEmployees() {
		return this.employees;
	}

	public void setEmployees(Set<Employee> employees) {
		this.employees = employees;
	}

}
